package com.qianli.t263.util;


public class Singleton {
    private static Singleton singleton = new Singleton();
    //只能创建一个实例
    private Singleton(){
        System.out.println("创建实例");
    }
    //全局访问点
    public static Singleton getInstance(){
        if(singleton == null){
            //由自己创建实例
            singleton = new Singleton();
        }
        System.out.println("实现");
        return singleton;
    }
}
